home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Source Code / Pascal / Snippets / PNL Libraries / Libraries / MenuSharing / menusharing.h < prev    next >
Text File  |  1996-07-18  |  3KB  |  123 lines

  1.  
  2. /*© copyright 1991-96 UserLand Software, Inc. All Rights Reserved.*/
  3.  
  4.  
  5. #ifndef __APPLEEVENTS__
  6.  
  7.     #include <AppleEvents.h>
  8.  
  9. #endif
  10.  
  11. #ifndef __COMPONENTS__
  12.  
  13.     #include <Components.h> /*3.0*/ 
  14.  
  15. #endif
  16.  
  17. #ifndef __MENUS__
  18.  
  19.     #include <Menus.h> /*3.0*/
  20.     
  21. #endif
  22.  
  23.  
  24. #define __MENUSHARING__ /*so other modules can tell that we've been included*/
  25.  
  26. //    RMS 960614
  27. #if PRAGMA_ALIGN_SUPPORTED
  28. #pragma options align=mac68k
  29. #endif
  30.  
  31. typedef struct tysharedmenurecord { /*must match scripting system record structure*/
  32.     
  33.     short idmenu; /*the resource id of the menu*/
  34.     
  35.     short flhierarchic: 1; /*if true it's a hiearchic menu*/
  36.     
  37.     short flinserted: 1; /*if true the menu has been inserted in the menu bar*/
  38.     
  39.     MenuHandle hmenu; /*a handle to the Mac Menu Manager's data structure*/
  40.     } tysharedmenurecord;
  41.  
  42.  
  43. typedef tysharedmenurecord tymenuarray [1];
  44.  
  45. typedef tymenuarray **hdlmenuarray;
  46.  
  47. typedef pascal void (*tyMSerrordialog) (Str255);
  48.  
  49. typedef pascal void (*tyMSeventfilter) (EventRecord *);
  50.  
  51. typedef pascal void (*tyMSmenusinstaller) (hdlmenuarray);
  52.  
  53.  
  54.  
  55. typedef struct tyMSglobals { /*Menu Sharing globals, all in one struct*/
  56.  
  57.     OSType serverid; /*identifier for shared menu server*/
  58.  
  59.     OSType clientid; /*id of this application*/
  60.     
  61.     hdlmenuarray hsharedmenus; /*data structure that holds shared menus*/
  62.     
  63.     Boolean fldirtysharedmenus; /*if true, menus are reloaded next time app comes to front*/
  64.     
  65.     Boolean flscriptcancelled; /*set true by calling CancelSharedScript*/
  66.     
  67.     Boolean flscriptrunning; /*true if a script is currently running*/
  68.     
  69.     Boolean flinitialized; /*true if InitSharedMenus was successful*/
  70.     
  71.     long idscript; /*the server's id for the currently running script, makes it easy to kill it*/
  72.     
  73.     ComponentInstance menuserver; /*3.0*/ 
  74.     
  75.     long serverversion; /*4.1*/
  76.     
  77.     tyMSerrordialog scripterrorcallback; /*3.0*/
  78.     
  79.     tyMSeventfilter eventfiltercallback; /*3.0*/
  80.     
  81.     tyMSmenusinstaller menusinsertercallback; /*4.1*/
  82.     
  83.     tyMSmenusinstaller menusremovercallback; /*4.1*/
  84.     } tyMSglobals;
  85.  
  86.  
  87. extern tyMSglobals MSglobals; /*menu sharing globals*/
  88.  
  89.  
  90. /*basic Menu Sharing routines*/
  91.  
  92.     pascal Boolean InitSharedMenus (tyMSerrordialog, tyMSeventfilter);
  93.  
  94.     pascal Boolean SharedMenuHit (short, short);
  95.     
  96.     pascal Boolean SharedScriptRunning (void);
  97.     
  98.     pascal Boolean CancelSharedScript (void);
  99.     
  100.     pascal Boolean CheckSharedMenus (short);
  101.     
  102.     pascal Boolean SharedScriptCancelled (AppleEvent *, AppleEvent *);
  103.     
  104.  
  105. /*special-purpose routines*/
  106.  
  107.     pascal Boolean DisposeSharedMenus (void);
  108.  
  109.     pascal Boolean IsSharedMenu (short);
  110.     
  111.     pascal Boolean EnableSharedMenus (Boolean);
  112.     
  113.     pascal Boolean RunSharedMenuItem (short, short);
  114.  
  115.     pascal Boolean SetMenusInserterCallback (tyMSmenusinstaller);
  116.     
  117.     pascal Boolean SetMenusRemoverCallback (tyMSmenusinstaller);
  118.     
  119. //    RMS 960614    
  120. #if PRAGMA_ALIGN_SUPPORTED
  121. #pragma options align=reset
  122. #endif
  123.